<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page session="false"%>
<jsp:useBean id="now" class="java.util.Date"/>

<html>
<head>
<title>DEV Information Page</title>
</head>
<body>

	<c:if test="${empty userLoggin }">
		<c:redirect url="${pageContext.request.contextPath}" />
	</c:if>
	<div style="padding-left: 150px;">

		<h3 style="text-align: right;"> Welcome ${PMInfo.username} | 
			<a href="${pageContext.request.contextPath}">Logout</a> | 
			<a href="${pageContext.request.contextPath}/changePasswordPM/${PMInfo.username}">Change Password</a>
		</h3>
		<c:if test="${checkAvailable}">
			<a
				href="${pageContext.request.contextPath}/project/new/${PMInfo.username}">Create
				New Project</a>
		</c:if>
		
		
		
		<table style="font-size: 15pt">
			<tbody>
				<tr>
					<td>Project</td>
					<td><c:forEach items="${PMInfo.projectUsers}" var="projects">
							<c:if test="${projects.project.enddate > now || empty projects.project.enddate}">
								${projects.project.code}
								<c:set var="projectCode" value="${projects.project.code}"></c:set>
							</c:if>
						</c:forEach></td>
				</tr>
				<tr>
					<td>Full Name</td>
					<td>${PMInfo.fullname}</td>
				</tr>
				<tr>
					<td>Address</td>
					<td>${PMInfo.address}</td>
				</tr>
				<tr>
					<td>Phone</td>
					<td>${PMInfo.phone}</td>
				</tr>
				<tr>
					<td colspan="2" style="text-align: right; padding-top: 10px;">
						<a
						href="${pageContext.request.contextPath}/updatePM/${PMInfo.username}">Update
							Information</a>
					</td>
				</tr>
			</tbody>

		</table>
	</div>
	<c:if test="${not checkAvailable}">
	<div align="center" style="padding-top: 50px;">
		<h1>List of Developer in Project</h1>
		<form action="createPM" method="POST">
			<table style="font-size: 15pt" border="1">
				<thead>
					<tr>
						<th>No.</th>
						<th>Username</th>
						<th>Full Name</th>
						<th>Address</th>
						<th>Phone</th>
						<th colspan="2">Action</th>
					</tr>
				</thead>
				<tbody>								
					<c:forEach items="${project}" var="users" varStatus="count">
						<c:if test="${users.user.group.code eq 'DEV' }">
							<tr>
								<td>${count.index}</td>
								<td>${users.user.username}</td>
								<td>${users.user.fullname}</td>
								<td>${users.user.address}</td>
								<td>${users.user.phone}</td>
								<td><a
										href="${pageContext.request.contextPath}/update/${users.user.username}/${PMInfo.username}">Edit</a>
								</td>
								<td><a
										href="${pageContext.request.contextPath}/remove/${users.user.username}/${PMInfo.username}/${projectCode}">Remove</a></td>
								</tr>
						</c:if>
					</c:forEach>
				</tbody>

			</table>
			<div style="padding-top: 15px; padding-left: 351px;">
				<a href="${pageContext.request.contextPath}/createDEV/${projectCode}/${PMInfo.username}">
					<input type="button" value="Add New Developer" />
				</a>
				<a href="${pageContext.request.contextPath}/unprojectDEV/${PMInfo.username}">
					<input type="button" value="List Unproject DEV" />
				</a>
			</div>
		</form>
	</div>
	</c:if>
</body>
</html>
